# RUN: llc -mtriple=i686-unknown-unknown -run-pass=x86-flags-copy-lowering \
# RUN:  -print-after=x86-flags-copy-lowering %s -o - | FileCheck %s
#
# Check that $eflags is removed from live-in lists of successor blocks.
#
# CHECK-NOT: liveins: $eflags

--- |
  define void @fun(i16 %arg, i64 %arg1, i8 %arg2, ptr %arg3, i32 %arg4) { ret void}
...
---
name:            fun
alignment:       16
tracksRegLiveness: true
registers:
  - { id: 0, class: gr16 }
  - { id: 1, class: gr16 }
  - { id: 2, class: gr16 }
  - { id: 3, class: gr32 }
  - { id: 4, class: gr32 }
  - { id: 5, class: gr8 }
  - { id: 6, class: gr32 }
  - { id: 7, class: gr32 }
  - { id: 8, class: gr32 }
  - { id: 9, class: gr32 }
  - { id: 10, class: gr32 }
  - { id: 11, class: gr32 }
  - { id: 12, class: gr32 }
  - { id: 13, class: gr8 }
  - { id: 14, class: gr32 }
  - { id: 15, class: gr32 }
  - { id: 16, class: gr32_abcd }
  - { id: 17, class: gr8 }
  - { id: 18, class: gr8 }
  - { id: 19, class: gr32 }
  - { id: 20, class: gr32 }
frameInfo:
  maxAlignment:    4
fixedStack:
  - { id: 0, offset: 20, size: 4, alignment: 4, isImmutable: true }
  - { id: 1, offset: 16, size: 4, alignment: 4, isImmutable: true }
  - { id: 2, offset: 12, size: 1, alignment: 4, isImmutable: true }
  - { id: 3, offset: 8, size: 4, alignment: 4, isImmutable: true }
  - { id: 4, offset: 4, size: 4, alignment: 4, isImmutable: true }
  - { id: 5, size: 2, alignment: 4, isImmutable: true }
machineFunctionInfo: {}
body:             |
  bb.0:
    %4:gr32 = MOV32rm %fixed-stack.3, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.3)
    %3:gr32 = MOV32rm %fixed-stack.4, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.4)
    %7:gr32 = MOV32rm %fixed-stack.0, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.0)
    %6:gr32 = MOV32rm %fixed-stack.1, 1, $noreg, 0, $noreg :: (load (s32) from %fixed-stack.1)
    %5:gr8 = MOV8rm %fixed-stack.2, 1, $noreg, 0, $noreg :: (load (s8) from %fixed-stack.2, align 4)
    %9:gr32 = IMPLICIT_DEF
    %11:gr32 = IMPLICIT_DEF
  
  bb.1:
    successors: %bb.2, %bb.3
  
    CMP32rr %3, %9, implicit-def $eflags
    %10:gr32 = SBB32rr %4, %11, implicit-def $eflags, implicit $eflags
    %12:gr32 = COPY $eflags
    %13:gr8 = SETCCr 12, implicit $eflags
    %14:gr32 = MOVZX32rr8 killed %13
    %15:gr32 = NEG32r %14, implicit-def dead $eflags
    %16:gr32_abcd = MOV32r0 implicit-def dead $eflags
    $eflags = COPY %12
    %17:gr8 = COPY %16.sub_8bit
    JCC_1 %bb.3, 12, implicit $eflags
  
  bb.2:
    liveins: $eflags
  
  
  bb.3:
    successors: %bb.4, %bb.5
    liveins: $eflags
  
    %18:gr8 = PHI %5, %bb.2, %17, %bb.1
    MOV8mr %6, 1, $noreg, 0, $noreg, killed %18 :: (volatile store (s8) into %ir.arg3)
    JCC_1 %bb.5, 12, implicit $eflags
  
  bb.4:
  
  bb.5:
    %19:gr32 = PHI %16, %bb.4, %15, %bb.3
    $eax = COPY %7
    CDQ implicit-def $eax, implicit-def $edx, implicit $eax
    IDIV32r killed %19, implicit-def dead $eax, implicit-def $edx, implicit-def dead $eflags, implicit $eax, implicit $edx
    JMP_1 %bb.1

...
